//数组扩容
public class ArrayAdd{
	//编写一个main的主方法
	public static void main(String[] args){
		int arr[] = {10,12,45,90};
		int num = 23;
		int index = -1;
		

		for(int i = 0; i <= arr.length ; i++){
			//System.out.println(num);
			//System.out.println(arr.length + 1);
			
			if( num <= arr[i]){
				index = i;
				break;
			}
			
		}

		//判断index的值
		if(index == -1 ){
			index = arr.length;
		}

		//扩容
		int newArr[] = new int[arr.length + 1];
		for(int i = 0, j = 0; i < newArr.length; i++){
			if( i != index){
				newArr[i] = arr[j];
				j++;
			}else{
				newArr[i] = num;
			}
		}

		arr = newArr;

		for(int i = 0 ; i < arr.length; i++){
			System.out.print(arr[i]+"\t");
		}
		System.out.print("\n");
	}
}